

class CalendarTaskListEntity {
  int ret;
  String msg;
  CalendarRowsData data;

  CalendarTaskListEntity({this.ret, this.data, this.msg});

  CalendarTaskListEntity.fromJson(Map<String, dynamic> json) {
    ret = json['ret'];
    msg = json['msg'];
    data = json['data'] != null ? new CalendarRowsData.fromJson(json['data']) : null;
  }
}

class CalendarRowsData {
  int total;
  List<CalendarTaskEntity> rows;

  CalendarRowsData({this.total, this.rows});

  CalendarRowsData.fromJson(Map<String, dynamic> json) {
    total = json['total'];
    if (json['rows'] != null) {
      rows = new List<CalendarTaskEntity>();
      json['rows'].forEach((v) {
        //过滤日期为空的数据
        if (v['COURSE_START_DATE'] != null && v['COURSE_END_TIME'] != null) {
          rows.add(new CalendarTaskEntity.fromJson(v));
        }

      });
    }
  }
}

class CalendarTaskEntity {
  /// 商品名
  String shopName;
  /// 任务名称
  String courseName;
  /// 开始时间 12:00
  String beginTime;
  /// 结束时间 14:00
  String endTime;
  /// 展示互动直播密码
  String liveToken;
  /// 展示互动直播地址
  String liveUrl;
  /// 展示互动回放 url
  String vodUrl;
  /// 展示互动回放 token
  String vodToken;
  ///直播结束时间 yyyy-MM-dd hh:mm:ss
  DateTime courseEndTime;
  /// 直播开始时间  yyyy-MM-dd hh:mm:ss
  DateTime courseStartTime;
  /// 分组日期 yyyy-MM-dd
  DateTime date;


  CalendarTaskEntity({
    this.shopName,
    this.courseName,
    this.beginTime,
    this.endTime,
    this.liveToken,
    this.liveUrl,
    this.vodUrl,
    this.vodToken,
    this.courseEndTime,
    this.courseStartTime,
    this.date,
  });

  CalendarTaskEntity.fromJson(Map<String, dynamic> json) {
    shopName = json['SHOP_NAME'];
    courseName = json['COURSENAME'];
    beginTime = json['CLASS_BEGIN_TIME'];
    endTime = json['CLASS_END_TIME'];
    liveToken = json['STU_CUSTOMER_TOKEN'];
    liveUrl = json['STU_URL'];
    vodUrl = json['B_ADDRESS'];
    vodToken = json['B_TOKEN'];
    //注意 在上面的方法调用处 过滤掉了这个字段为空的情况
    courseStartTime = DateTime.parse(json['COURSE_START_DATE']);
    courseEndTime = DateTime.parse(json['COURSE_END_TIME']);
    //分组用日期
    date = DateTime(courseStartTime.year, courseStartTime.month, courseStartTime.day);
  }


}
